/*
 * @Author: yansheng 610363806@qq.com
 * @Date: 2024-06-30 01:05:03
 * @LastEditors: yansheng 610363806@qq.com
 * @LastEditTime: 2024-07-01 22:55:10
 * @FilePath: \celllf:\zxs\cell-admin\src\utils\power.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
export const getPower = (power) => {
    if (localStorage.getItem('usi')) {


        const defPower = JSON.parse(localStorage.getItem('usi')).power
        return defPower >= power
    }
    return false
}

export const extractImageUrls = (richText) => {
    // 创建一个新的DOM元素（通常使用div），并将HTML字符串设置为其innerHTML
    // 这样做是为了能够使用DOM API来解析和遍历HTML
    const parser = new DOMParser();
    const doc = parser.parseFromString(richText, 'text/html');

    // 查找所有的<img>标签
    const images = doc.querySelectorAll('img');

    // 提取每个<img>标签的src属性，并收集到一个数组中
    const urls = Array.from(images).map(img => img.src);

    // 返回包含所有图片URL的数组
    return urls;
}
import OSS from 'ali-oss'
import { getUpdateToken, upload_ali, uploadSysToken } from '@/api/index'
export const deleteMultiples = (images) => {
    uploadSysToken({}).then(res1 => {
        let oss = new OSS({...res1.stsToken })
        let newUrl = images.map(val => val.split(res1.stsToken.endpoint + '/')[1])

        oss.deleteMulti(newUrl).then(res => {})
    })
}